﻿using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc.Testing;

namespace VisionSurface.WebxUnitTest
{
    /// <summary>
    /// 自定义WebApplicationFactory
    /// </summary>
    /// <typeparam name="TStartup"></typeparam>
    public class CustomWebApplicationFactory<TStartup> : WebApplicationFactory<TStartup> where TStartup : class
    {
        protected override void ConfigureWebHost(IWebHostBuilder builder)
        {
            //设定环境变量
            builder.UseContentRoot("..\\..\\..\\..\\..\\VisionSurface.Web\\bin\\Debug\\netcoreapp3.1");
            builder.UseWebRoot("..\\..\\..\\..\\VisionSurface.Web\\wwwroot");
            builder.UseEnvironment("Local");
            base.ConfigureWebHost(builder);
        }
    }
}
